import {contextBridge} from 'electron'
import {electronAPI} from '@electron-toolkit/preload'
import {ipcRenderer} from "electron";

const setTitle = async (title:string)=>{
    return await ipcRenderer.invoke('setTitle', title);
}
const setTransparent = async (parameter) =>{
    return await ipcRenderer.invoke('setTransparent',parameter)
}

const showError = async (args)=> {
    return  await ipcRenderer.invoke('showError',args)
}

const on = (value,callback)=>{
    ipcRenderer.on(value,callback)
}


contextBridge.exposeInMainWorld('electron', electronAPI)
contextBridge.exposeInMainWorld('api',{
    setTitle,
    setTransparent,
    showError,
    on
})